def get_centerpoint(lis):
    area = 0.0
    x, y = 0.0, 0.0

    a = len(lis)
    for i in range(a):
        lat = lis[i][0]  # weidu
        lng = lis[i][1]  # jingdu

        if i == 0:
            lat1 = lis[-1][0]
            lng1 = lis[-1][1]

        else:
            lat1 = lis[i - 1][0]
            lng1 = lis[i - 1][1]

        fg = (lat * lng1 - lng * lat1) / 2.0

        area += fg
        x += fg * (lat + lat1) / 3.0
        y += fg * (lng + lng1) / 3.0

    x = x / area
    y = y / area

    return x, y

import numpy as np
aa = np.array([[ 4, 11],
       [ 4,  5],
       [ 9,  9]])

get_centerpoint(aa)

from math import radians, cos, sin, degrees, atan2, sqrt
def center_geolocation(geolocations):
    '''
    输入多个经纬度坐标(格式：[[lon1, lat1],[lon2, lat2],....[lonn, latn]])，找出中心点
    :param geolocations:
    :return:中心点坐标  [lon,lat]
    '''
    # 求平均数  同时角度弧度转化 得到中心点
    x = 0  # lon
    y = 0  # lat
    z = 0
    lenth = len(geolocations)
    for lon, lat in geolocations:
        lon = radians(float(lon))
        #  radians(float(lon))   Convert angle x from degrees to radians
        # 	                    把角度 x 从度数转化为 弧度
        lat = radians(float(lat))
        x += cos(lat) * cos(lon)
        y += cos(lat) * sin(lon)
        z += sin(lat)
        x = float(x / lenth)
        y = float(y / lenth)
        z = float(z / lenth)
    return (degrees(atan2(y, x)), degrees(atan2(z, sqrt(x * x + y * y))))

center_geolocation(aa)